package com.example.wtt.controller;

import com.example.wtt.common.Result;
import com.example.wtt.entity.Painting;
import com.example.wtt.service.PaintingService;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/paint") // 统一给接口加前缀
public class PaintingController {
    @Autowired
    private PaintingService paintingService;

    // 绘画
    @PostMapping
    public Result paint(@RequestBody Painting painting) {
        return Result.success(paintingService.paint(painting));
    }

    // 收藏
    @PostMapping("/favorite")
    public Result favorite(@RequestBody Painting painting) {
        System.out.println(painting);
        return Result.success(paintingService.updateById(painting));
    }
}
